package com.jige.jigetodo.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jige.jigetodo.model.dto.user.UserQueryRequest;
import com.jige.jigetodo.model.dto.user.UserUpdateRequest;
import com.jige.jigetodo.model.entity.User;
import com.jige.jigetodo.model.vo.UserVO;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.List;

/**
 * @author Administrator
 * @description 针对表【user】的数据库操作Service
 * @createDate 2025-05-06 17:07:27
 */
public interface UserService extends IService<User> {

    /**
     * 用户注册
     */
    boolean register(String account, String password, String checkPassword,String code,HttpServletRequest request) throws IOException;

    /**
     * 用户登录
     */
    UserVO userLogin(String account, String password,String code, HttpServletRequest request);

    /**
     * 用户注销
     */
    boolean userLogOut(HttpServletRequest request);

    /**
     * 更新用户信息
     */
    boolean updateUser(UserUpdateRequest userUpdateRequest, HttpServletRequest request);

    /**
     * 重置密码
     */
    boolean resetPassword(String userAccount, String oldPassword, String newPassword, String checkPassword);

    /**
     * 查询单个用户
     */
    User getUserById(Long id, HttpServletRequest request);

    /**
     * 根据id查询用户脱敏信息
     */
    UserVO getUserVOById(Long id, HttpServletRequest request);


/*    *//**
     * 分页查询用户列表（仅管理员可用）
     *//*
    List<User> listUserByPage(List<User> userList,HttpServletRequest request);*/

    /**
     * 分页查询用户脱敏列表
     */
    List<UserVO> listUserVOByPage(List<User> userList,HttpServletRequest request);

    /**
     * 获取查询包装类
     * @param userQueryRequest
     * @return
     */
    QueryWrapper<User> getQueryWrapper(UserQueryRequest userQueryRequest);

    //  获取当前登录用户
    User getLoginUser(HttpServletRequest request);

    //  获取当前登录用户脱敏信息
    UserVO getLoginUserVO(HttpServletRequest request);


}
